home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1997-04-02 | 3.5 KB | 262 lines |
- '----------------------------------------------------
- ' mario clone v1.1
- '----------------------------------------------------
- ' keller@vip.cybercity.dk
- ' rune keller
- ' sporuplundsvej 105
- ' dk-8472 sporup
- '----------------------------------------------------
- ' finished o2/o4/1997 13:41:26
- '----------------------------------------------------
-
- 'set up a screen
-
- Screen Open 0,320,256,32,Lowres
- Flash Off
- Curs Off
- Hide
- Cls 0
-
- Get Sprite Palette
-
-
-
- 'use a double buffered screen
-
- Double Buffer
- Autoback 1
- Update Off
-
-
-
- 'draw a line for the hero to walk on
-
- Ink 7
- Draw 0,224 To 319,224
-
-
-
- 'the walking speed of the hero. should be 1,2 or 4
-
- _SPEED=2
-
-
-
- 'the max time the player must increase the height of a jump
-
- _MAXTIME=6
-
-
-
- 'the max height of a jump. in pixels a value of eg. 6 would
- 'mean an actual height of _MAXTIME*6+5+4+3+2+1
-
- _JUMPMAX=5
-
-
-
- 'the speed of jump or just the gravity. should be 1,2,3 or 4
-
- _JUMPSPEED=3
-
-
-
- 'frame rate of hero's walk animation. 1 = fastest
-
- _ANIMATIONSPEED=4
-
-
-
- 'hero's x and y positions
-
- _HEROX=10*16
- _HEROY=14*16
-
-
-
- 'which way is hero facing? -1 = left, 1 = right
-
- _FACING=1
-
-
-
- 'main loop
-
- Do
-
-
-
- 'reset variables
-
- _UP=False
- _DOWN=False
- _LEFT=False
- _RIGHT=False
- _FIRE=False
-
-
-
- 'get player input
-
- If Joy(1) and %10000 or Key State(76)
- _UP=True
- End If
-
- If Joy(1) and %100 or Key State(79)
- _LEFT=True
- Else If Joy(1) and %1000 or Key State(78)
- _RIGHT=True
- End If
-
-
-
- 'reset to frame 1 if no input from player is received
-
- If _UP=False and _DOWN=False and _LEFT=False and _RIGHT=False and _FIRE=False
- _FRAME=1
- End If
-
-
-
- 'if player walks left
-
- If _LEFT=True
-
-
-
- 'update animation
-
- If Timer mod _ANIMATIONSPEED=0 or _FRAME<2 or _FRAME>7
- Add _FRAME,1,2 To 7
- End If
-
- _FACING=-1
-
-
-
- 'move hero left
-
- If _HEROX-_SPEED=>10
- _HEROX=_HEROX-_SPEED
- End If
-
-
-
- 'if player walks right
-
- Else If _RIGHT=True
-
-
-
- 'update animation
-
- If Timer mod _ANIMATIONSPEED=0 or _FRAME<2 or _FRAME>7
- Add _FRAME,1,2 To 7
- End If
-
- _FACING=1
-
-
-
- 'move hero right
-
- If _HEROX+_SPEED<=310
- _HEROX=_HEROX+_SPEED
- End If
-
- End If
-
-
-
- 'if player jumps
-
- If _UP=True and _TIME<_MAXTIME
-
-
-
- 'if player is not already jumping
-
- If _JUMPING=False
-
- _JUMPING=True
- _JUMPMOVE=-_JUMPMAX*_JUMPSPEED
-
- End If
-
-
-
- 'move hero up
-
- _HEROY=_HEROY+_JUMPMOVE/_JUMPSPEED
- Inc _TIME
-
- Else
-
-
-
- 'change jump offset
-
- If _JUMPMOVE<_JUMPMAX*_JUMPSPEED+1
- _JUMPMOVE=_JUMPMOVE+1
- End If
-
- End If
-
-
-
- 'if player is jumping
-
- If _JUMPING=True
-
-
-
- 'change frame to jump animation
-
- _FRAME=8
-
-
-
- 'if hero falls down onto the line
-
- If _HEROY+_JUMPMOVE/_JUMPSPEED=>14*16
-
- _HEROY=14*16
- _JUMPING=False
- _TIME=0
-
- Else
-
-
-
- 'move hero up/down
-
- _HEROY=_HEROY+_JUMPMOVE/_JUMPSPEED
-
- End If
-
- End If
-
-
-
- 'display hero
-
- If _FACING=1
- Bob 0,_HEROX,_HEROY,_FRAME
- Else If _FACING=-1
- Bob 0,_HEROX,_HEROY,_FRAME+$8000
- End If
-
-
-
- 'update screen
-
- Bob Draw
- Wait Vbl
- Screen Swap
- Bob Clear
-
-
-
- 'end loop
-
- Loop